import Vue from 'vue'
import Router from 'vue-router'
import page_1 from '@/pages/page_1'
import page_2 from '@/pages/page_2'
import page_3 from '@/pages/page_3'
import page_4 from '@/pages/page_4'
import head from '@/components/head'

import nav from '@/components/nav'
import foot from '@/components/foot'

Vue.use(Router)

export default new Router({
  routes: [
      {
          path: '/struct/:username',
          name: 'page',
          components: {
            head:head,
            default:page_1
          },
          props: {
              head: true,
              default: true
          }
      },
      {
          path: '/',
          redirect: '/struct_1'
      },
      {
          path: '/page_3',
          name: 'page_3',
          component: page_3
      },
      {
          path: '/page_4',
          name: 'page_4',
          component: page_4
      },
      {
          path: '/struct_1',
          components: {
              nav:nav,
              body:page_1,
              foot:foot,
          }
      },
      {
          path: '/struct_3',
          components: {
              nav:nav,
              body:page_3
          }
      },
      {
          path: '/struct_2/:postId',
          components:{
              nav:nav,
              body:page_2,
              foot:foot,
          },
          props: {
              nav: false,
              body: true,
              foot:false,
          }
      },
  ],
    scrollBehavior (to, from, savedPosition) {
        // if (savedPosition) {
        //     return savedPosition
        // } else {
        //     return { x: 0, y: 0 }
        // }
        return { x: 0, y: 0 }
    }
})
